package jk.fox.config.transport.netty;

import jk.fox.common.payload.message.MessageDispatcher;
import jk.fox.config.transport.TransportConfiguration;
import jk.fox.transport.Transport;
import jk.fox.transport.netty.NettyTransport;
import lombok.Getter;
import lombok.Setter;

/**
 * @author cuichao
 * @Description: NettyConfiguration
 * @Date: create in 2020/5/14 16:36
 */
@Getter
@Setter
public class NettyConfiguration extends TransportConfiguration {

    /**
     * netty 服务端 work-eventLoopGroup数量
     */
    private int serverWorkGroup = 0;
    /**
     * netty客户端tcp等待列队最大数
     */
    private int serverTcpBacklog = 128;
    /**
     *是否关闭Nagle算法
     */
    private boolean disableNagle = true;
    /**
     * 是否开启长连接模式
     */
    private boolean KeepAlive = true;
    /**
     * 是否开启服务端心跳模式
     */
    private boolean enableServerHeartBeat = true;
    /**
     * 是否开启客户端心跳模式
     */
    private boolean enableClientHeartBeat = true;
    /**
     * 读心跳间隔
     */
    private int readerIdleTimeSeconds = 10;
    /**
     * 写心跳间隔
     */
    private int writerIdleTimeSeconds = 10;
    /**
     * 读写心跳间隔
     */
    private int allIdleTimeSeconds = 0;


    @Override
    public Transport create(MessageDispatcher dispatcher) {
        return  new NettyTransport(this,dispatcher);
    }
}
